package createJfinalFileV1;

import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Scanner;

/**
 * @author 马洁
 * @date 2019/11/15 - 17:44
 */
public class Main {
    private static final String FILE_END = "end";

    public static void main(String[] args) throws IOException, ClassNotFoundException, NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException {
        Scanner input = new Scanner(System.in);

        System.out.println("请输入创建目录");
        String path = input.next();

        System.out.println("请输入默认包名");
        String defaultPackage = input.next();

        System.out.println("请输入要创建文件的包名, 并以空格分隔");
        ArrayList<String> list = new ArrayList<>(Config.DEFAULT_ARRAY_SIZE);

        while (input.hasNext()) {
            String next = input.next();
            if (FILE_END.equals(next)) {
                break;

            }

            list.add(next);
        }

        CreateFileMain.create(path, defaultPackage, list.toArray(new String[0]));
    }
}
